/*
 * pid.h
 *
 *  Created on: Sep 19, 2025
 *      Author: lianz
 */

#ifndef INC_PID_H_
#define INC_PID_H_

#include <stdint.h>

extern float pitch, roll, yaw;
extern short gyrox, gyroy, gyroz, aacx, aacy, aacz;
extern int Lencoder, Rencoder;
extern uint8_t control_cmd;
extern float med_angle;					// 直立环
extern int speed_target;				// 速度环
extern int target_turn;					// 转向环
extern int stright_plus, turn_plus, forward_plus, back_plus, left_plus, right_plus;
extern int pwm_out, velocity_out, vertical_out, turn_out, total_out, moto1, moto2;
extern uint8_t control_cmd;
extern uint8_t angle_stop_cmd;
extern uint8_t force_stop_cmd;

int pid_abs(int num);
void Get_Angle_Mid(void);

void Control(void);
void PID_Tick(void);

void Angle_Check(void);
void Motor_Check(void);

#endif /* INC_PID_H_ */
